// pages/article/article.js

Page({

  /**
   * 页面的初始数据
   */
  data: {
    current: 0,
    list: [], // 存放新闻列表
  },

  chBtn: function (e) {
    this.setData({
      current: e.target.dataset.current
    })
  },

  chSwiper: function (e) {
    this.setData({
      current: e.detail.current
    })
  },

  onLoad(options) {
    var url = 'http://10.99.153.50:8080/api/article'
    var that = this
    wx.request({
      url: url,
      success: function (res) {
        console.log(res)
        var list = res.data.data
        console.log('this = ', this)
        that.setData({
          list: list
        })
      }
      // success: (res) => {
      //   console.log(res)
      //   var list = res.data.data
      //   this.setData({
      //     list: list
      //   })
      // }
    })
  }
})